/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: MemIf.c
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: MemIf
*
*******************************************************************************/

/** HEADER FILES **/
#include "MemIf.h"


/** MACRO DEFINITION **/


/** TYPEDEF DEFINITION **/


/** LOCAL DATA DECLARATION **/


/** GLOBAL DATA DECLARATION **/


/** LOCAL FUNCTION DECLARATION **/


/** GLOBAL FUNCTION DECLARATION **/
void MemIf_GetVersionInfo(
    Std_VersionInfoType* versionInfo
);


Std_ReturnType MemIf_Read(
    uint16 DeviceIndex,
    uint16 BlockNumber,
    uint16 BlockOffset,
    uint8* DataBufferPtr,
    uint16 Length
);


Std_ReturnType MemIf_Write(
    uint16 DeviceIndex,
    uint16 BlockNumber,
    const uint8* DataBufferPtr
);

/** LOCAL DATA **/


/** GLOBAL DATA **/


/** LOCAL FUNCTION **/


/** GLOBAL FUNCTION **/

/*******************************************************************************
* -Name            MemIf_GetVersionInfo
* -Brief           Returns the version information of this module 
* -Details         None
* -Param[out]      versioninfo: Pointer to the version information of this module
* -Return          None          
*******************************************************************************/
void MemIf_GetVersionInfo(
    Std_VersionInfoType* versionInfo
)
{
    versionInfo->vendorID = (uint16)YSAR_VENDOR_ID;
    versionInfo->moduleID = (uint8)MEMIF_MODULE_ID;
    versionInfo->sw_major_version = (uint8)MEMIF_SW_MAJOR_VERSION;
    versionInfo->sw_minor_version = (uint8)MEMIF_SW_MINOR_VERSION;
    versionInfo->sw_patch_version = (uint8)MEMIF_SW_PATCH_VERSION;
}


/*******************************************************************************
* -Name            MemIf_Write
* -Brief           Returns the version information of this module 
* -Details         None
* -Param[in]       DeviceIndex: 
* -Param[in]       BlockNumber: 
* -Param[in]       BlockNumber: 
* -Param[out]      BlockOffset: 
* -Param[in]       Length: 
* -Return          None          
*******************************************************************************/
Std_ReturnType MemIf_Read(
    uint16 DeviceIndex,
    uint16 BlockNumber,
    uint16 BlockOffset,
    uint8* DataBufferPtr,
    uint16 Length
)
{
    MemIf_MemHwaApis[DeviceIndex].Read(BlockNumber, BlockOffset, DataBufferPtr, Length);
}



/*******************************************************************************
* -Name            MemIf_Write
* -Brief           Returns the version information of this module 
* -Details         None
* -Param[in]       DeviceIndex: 
* -Param[in]       BlockNumber: 
* -Param[in]       DataBufferPtr: 
* -Return          None          
*******************************************************************************/
Std_ReturnType MemIf_Write(
    uint16 DeviceIndex,
    uint16 BlockNumber,
    const uint8* DataBufferPtr
)
{
    MemIf_MemHwaApis[DeviceIndex].Write(BlockNumber, DataBufferPtr);
}


